#pragma once
#include "Channel.h"
#include "EventLoop.h"

struct EventLoop;
struct Dispatcher
{
    //init--初始化epoll,poll,或者select需要的数据块
    void* (*init)();
    //add
    int (*add)(struct Channel* Channel, struct EventLoop* eventLoop);
    //del
    int (*remove)(struct Channel* Channel, struct EventLoop* eventLoop);
    //修改
    int (*modify)(struct Channel* Channel, struct EventLoop* eventLoop);
    //事件监测
    int (*dispatch)(struct EventLoop* eventLoop, int timeout);//单位:s
    //清除数据(关闭fd或者释放内存)
    int (*clear)(struct EventLoop* eventLoop);
};